PROG             = gruges.exe
LIB              = src\\libtext.lib

SOURCES_ASM      = g100_fonx.asm text.asm print_small.asm print_norm.asm print_big.asm aff_bmp.asm cfile_base.asm
SOURCES_C        = main.c
OBJS_lib         = $(SOURCES_ASM:%.asm=%.obj)
OBJS             = $(SOURCES_C:%.c=%.obj)

RM               = $(EXE_PATH)rm -f
SED              = $(EXE_PATH)sed
SLEEP            = $(EXE_PATH)sleep
LINK             = dmc
NASM             = nasm-v30
DMC              = dmc -Iincludes
LIB_PROG         = dmc-lib

OBJFMT		 = obj

all: $(PROG)

disk: gruges.lec

$(PROG): $(OBJS)
	$(MAKE) -C src
	$(LINK) -msd -Bf -2 -Ns -o+all -o $(@) $(^) $(LIB) 


%.obj: %.asm
	$(NASM) -f$(OBJFMT) $(<) -o $(@)

%.obj : %.c
	$(DMC) -msd -Bf -2 -Ns -o+all -c $(<)

clean:
	$(MAKE) -C src clean
	-$(RM) *.obj *.OBJ .deps *.bak *.map $(PROG) $(LIB)

gruges.lec: $(PROG)
	romdisk $(@) $(PROG)

envoi: gruges.lec
	$(SLEEP) 1
	f100console gcomm 0 0 MAX232 1 Flash6  $(<)


.PHONY: envoi all clean pictures dist
